import { defineConfig } from 'unocss'
import { presetUno, presetWebFonts } from 'unocss'
import { animatedUno } from 'animated-unocss'

export default defineConfig({
  presets: [
    presetUno(),
    animatedUno(),
    presetWebFonts({
      fonts: {
        sans: 'Roboto,DM Sans,sans-serif',
        serif: 'DM Serif Display,serif',
        mono: 'DM Mono,monospace'
      }
    })
  ],
  shortcuts: [
    {
      'flex-center': 'flex justify-center items-center'
    }
  ],
  rules: [
    [
      /^text-(.*)$/,
      ([, c], { theme }) => {
        if (theme.colors[c]) {
          return { color: theme.colors[c] }
        }
      }
    ],
    [
      /^bg-(.*)$/,
      ([, c], { theme }) => {
        if (theme.colors[c]) {
          return { 'background-color': theme.colors[c] }
        }
      }
    ]
  ],
  theme: {
    colors: {
      primary: '#606C38',
      secondary: '#283618',
      default: '#FEFAE0',
      danger: '#E63946',
      success: '#2A9D8F',
      warning: '#F4A261',
      info: '#DDA15E',
      infoDark: '#BC6C25'
    }
  }
})
